<template>
  <box1>
    <div class="__content">
      <img v-if="currentImg" :src="currentImg"/>
    </div>

  </box1>
</template>

<script setup lang="ts">
import box1 from '../../compNew/box1.vue';
import * as API from '@/api/dataBoard';
import * as FileApi from '@/api/download';
import {onMounted, ref} from 'vue'

const currentImg = ref<any>('');
async function reloadIMG(senceId) {
  const ret = await FileApi.fileDownload({ id: senceId, isOnline: true })
  const blob = new Blob([ret])
  const reader = new window.FileReader();
  reader.readAsDataURL(blob)
  reader.onloadend = function () {
    currentImg.value = reader.result
  }
}
const getImg = async () => {
  const res = await API.getHomeImg({
    code: 'page-logo',
  });
  if (res) {
    reloadIMG(res.file.id)
  }
}
onMounted(() => {
  getImg();
})
</script>

<style lang="scss" scoped>
.__content {
  height: 100%;
  // background-image: url('./homeimg.png');
  // background-size: 94% 94%;
  // background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  img{
    width: 92%;
    height: 92%;
  }
}
</style>
